import 'package:flutter_flame/worlds/game/components/NormalZombie.dart';

// 僵尸池（复用僵尸）
class ZombiePool {
  final List<NormalZombie> _pool = [];

  NormalZombie getZombie(int row) {
    final zombie = _pool.firstWhere(
      (z) => !z.isMounted,
      orElse: () {
        return NormalZombie.randomWalkType(row);
      },
    );
    if (!_pool.contains(zombie)) {
      _pool.add(zombie);
    }
    return zombie;
  }
}
